package EMAIL_VISION::Tracker::API::TLE::Tracker;

use base qw( DE_EPAGES::Presentation::UI::Object );
use DE_EPAGES::Core::API::Log qw ( GetLog LogDebug );
use DE_EPAGES::Object::API::Factory qw( LoadObject ExistsObjectByPath LoadObjectByPath LoadClassByAlias);
use base DE_EPAGES::TLE::API::LoopHandler;
use EMAIL_VISION::Tracker::API::UriGenerator; 
use Time::localtime;
use Data::Dumper;

sub RegisterHandlerProc {
    my ($Params) = @_;
    GetLog->debug( 'Tracker.RegisterHandlerProc' );
    my $TLEProcessor = $Params->{'Processor'};
    my $Handler = __PACKAGE__->new();
    $TLEProcessor->registerHandler('FunctionHandler', $Handler, 'GenerateEmailVisionTrackingCode');
    #USED: /srv/epages/eproot/Cartridges/BIG/Design/Data/Private/Templates/DE_EPAGES/Content/Templates/SF/Category/Content-Pages.Pages_SingleColumn.html
}

sub new { bless {}, shift; }

sub GenerateEmailVisionTrackingCode {
  # my $self = shift;
   my ($self, $Processor, $aParams) = @_;
   my $Order = $aParams->[0];

   my $uriGen = new EMAIL_VISION::Tracker::API::UriGenerator($Order);
   my $uri = $uriGen->getUri();
   my $htmlTracker = "<!-- EMAIL_VISION -->";
   if($uri) {
   	$htmlTracker = "<img src=\"" . $uri . "\" border=\"0\" alt=\"\"/>";
   }
   return $htmlTracker;
}

1;

